package dbdoc4j.web;

import com.github.linmt.dbdoc4j.metadata.model.standard.TableModel;
import com.github.linmt.dbdoc4j.metadata.query.base.MetaDataQueryOperations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * User: Linmt
 * Date: 2022/12/3
 * Time: 23:21
 * Description: No Description
 */
@RestController
@RequestMapping(value = "/v1/dbdoc")
public class Dbdoc4jControllerWeb {

    private MetaDataQueryOperations metaDataQueryOperations;

    @Autowired
    private Dbdoc4jControllerWeb(MetaDataQueryOperations metaDataQueryOperations) {
        this.metaDataQueryOperations = metaDataQueryOperations;
    }

    @GetMapping(value = "/getDbMetaData")
    public List<TableModel> get() {
        List<TableModel> tableModels = metaDataQueryOperations.queryTableMetaData();
        return tableModels;
    }
}
